<template>
  <div>
    <!-- <p>ECharts 入门示例</p> -->
    <!-- 宽高！！！ -->
    <div id="main"></div>
  </div>
</template>

<script>
import * as echarts from 'echarts' // 引入全部组件，也可以按需引入
export default {
  name: 'MyEchart',
  data () {
    return {
      option: {
        title: {
          text: 'ECharts 入门示例'
        },
        tooltip: {},
        xAxis: {
          data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
        },
        yAxis: {},
        series: [
          {
            name: '销量',
            type: 'bar',
            data: [5, 20, 36, 10, 10, 20]
          }
        ]
      }
    }
  },
  mounted () {
    // 先在容器中初始化图表
    const myChart = echarts.init(document.getElementById('main'))
    // 给图表添加数据
    myChart.setOption(this.option)
  }
}
</script>

<style>
#main {
  width: 400px;
  height: 400px;
}
</style>
